<html>
<head><meta charset="utf-8"><title>Detect temporary within HIR expression · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Detect.20temporary.20within.20HIR.20expression.html">Detect temporary within HIR expression</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225332223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Detect%20temporary%20within%20HIR%20expression/near/225332223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Detect.20temporary.20within.20HIR.20expression.html#225332223">(Feb 05 2021 at 17:49)</a>:</h4>
<p>We have a clippy lint that lints a <code>match</code> expression with a single arm. But it is a false positive when the matched expression has a temporary like <code>match format_args!(..</code>. How do I check a HIR expression if it contains any temporaries? I tried playing with various methods of <code>ScopeTree</code> but couldn't find  a solution. I think I may need to use a Visitor but I figured I should ask for help before going further.</p>



<a name="225339092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Detect%20temporary%20within%20HIR%20expression/near/225339092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Detect.20temporary.20within.20HIR.20expression.html#225339092">(Feb 05 2021 at 18:41)</a>:</h4>
<p>...or does this require MIR analysis? <span aria-label="scared" class="emoji emoji-1f628" role="img" title="scared">:scared:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>